package com.flyduck.vueshop.system.remote.controller;

import com.flyduck.vueshop.common.core.lang.Result;
import com.flyduck.vueshop.common.sotoken.annotation.InnerAuth;
import com.flyduck.vueshop.system.remote.service.RemoteUserService;
import com.flyduck.vueshop.system.vo.RemoteUserRespVO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * SysUserApiController
 * </p>
 *
 * @author flyduck
 * @since 2024-07-09
 */
@RestController
@RequestMapping("/system/remote/user")
public class RemoteUserController {

    @Resource
    private RemoteUserService remoteUserService;

    @InnerAuth
    @GetMapping("/getUserByUsername")
    Result<RemoteUserRespVO> getUserByUsername(@RequestParam("username") String username){
        RemoteUserRespVO remoteUserRespVO = remoteUserService.getUserByUsername(username);
        return Result.success(remoteUserRespVO);
    }

    @InnerAuth
    @GetMapping("/getUserById/{id}")
    Result<RemoteUserRespVO> getUserById(@PathVariable("id") Long id){
        RemoteUserRespVO remoteUserRespVO = remoteUserService.getUserById(id);
        return Result.success(remoteUserRespVO);
    }
}
